<?php 	$cart =$this->cart;
if(!empty($cart)){
?>
<div class="container">		
			<section class="main-content">				
				<div class="fluid-row">
					<div class="span2"></div>
					<form action="cart.php" method="POST"> 
					<div class="span8 well">
							<h2><span class="text-error">Your Shopping Cart</span></h2>					
						<p class="alert alert-success">Please use this form to update your shopping cart. You may change the quantities, move items to your wish list for future purchasing, or remove items entirely. The shipping and handling cost is based upon the order total. When you are ready to complete your purchase, please click Checkout to be taken to a secure page for processing.</p>
						
						<table class="table table-striped">
							<thead>
								<tr>
									
									<th>Image</th>
									<th>Product Name</th>
									<th>Options</th>
									<th>Quantity</th>
									<th>Unit Price</th>
									<th>Total</th>
								</tr>
							</thead>
							<tbody>
								<?php 
								// Initialize the total:
								
									foreach($cart['items'] as $product) 
								{								
								echo '<tr>
								 		
										<td><a href="product.php?id='.$product['pid'].'"><img width="50px" height="50px" alt="" src="static/products/'.$product['image'].'"></a></td>
										<td>'.$product['name'].'</td>
										<td><a href="wishlist.php?pid=' . $product['pid'] . '&action=move&qty=' . $product['quantity'] .'">Move to Wish List</a><br /><a href="cart.php?pid=' . $product['pid'] . '&action=remove">Remove from Cart</a></td>										
										<td><input type="text" placeholder="1" class="input-mini" name="quantity[' . $product['pid'] . ']" value="' . $product['quantity'] . '"></td>
										<td>INR '.$product['finalprice'].'</td>
										<td>INR '.$product['subtotal'].'</td>
									</tr>';					
								
							
								}
								?>				  
								
							</tbody>
						</table>
						<hr>
						<p class="cart-total text-right">
							<strong>Sub-Total</strong>:	INR <?php echo $cart['subtotal']?><br>
							<strong>Shipping</strong>: INR <?php echo $cart['shipping']?><br>
							<strong>Total</strong>: INR<?php echo $cart['total']?><br>
						</p>
						<hr/>
						<p class="buttons text-right">				
							<button class="btn" type="submit">Update</button>	
							<button class="btn" type="button">Continue</button>
							<a href="checkout.php?session=<?php echo $this->uid; ?>" class="btn btn-inverse" id="checkout">Checkout</a>
						</p>											
					</div>
					</form>
					<div class="span2"></div>
				</div>
			</section>

</div>
<?php 
	}
	else
	{
	?>
		<div class="container">
				    <section class="header_text text-center">
						<h2><span class="text-error">Your Shopping Cart</span></h2>
					</section>	
				    <div class="alert alert-error">
            				<p class="text-center">Your shopping cart is currently empty.</p>
				    </div>
		</div>
	<?php
	}
	?>	
